7.4 Data Arithmetic

In MPL previously defined datavectors can be used to construct new datavectors. You construct a datavector by placing an arithmetic formula instead of the usual list of data elements in the DATA section. Here are some examples:

    DATA
        A[i,j]  :=  ...
        B[i]    :=  ...
        C[i,j]  :=  A + B/3;
        Total   :=  SUM(i,j: A);

If the formula starts with a datavector, its type is used to decide whether the resulting vector is dense or sparse. If the formula is a summation, the resulting vector is always dense. If the formula does not start with a datavector or a summation or you need to override the default type, you can use the keywords DENSE() and SPARSE() to specify the type. For example, to specify the C[i,j] vector as stored sparse, use:

    C[i,j]  :=  SPARSE(A + B/3)

Back To Top | Maximal Home Page | Table of Contents | Previous Page | Next Page